public class Test02 {
    public static void main(String[] args) {
        String strA="abcd";
        String strB="bdeab";
        System.out.println(check(strA,strB));



    }
    public static String rotate(String str)
    {
        char first=str.charAt(0);
        String end=str.substring(1);
        StringBuilder sb=new StringBuilder();
        sb.append(first).append(end);
        return sb.toString();

    }
    public static boolean check(String strA,String strB)
    {
        for (int i = 0; i <strA.length(); i++) {
            strA=rotate(strA);
            if(strA.equals(strB)){
                return true;
            }

        }
        return false;
    }
}
